export const apis = {
    featureproperty: `/ts/editor/property`,// 获取属性
}

// 获取属性
export const _getFeatureProperty = async (baseUrl: string, tileServiceName: string, featureId: string) => {
    const data = { tileServiceName, featureId };
    const token = window.localStorage.getItem("Authorization")
    const req = await fetch(baseUrl + apis.featureproperty, {
        method: "post",
        headers: {
            'Content-Type': 'application/json',
            ...(token ? { 'Authorization': token } : {})
        },
        body: JSON.stringify(data),

        mode: "cors", // 用来决定是否允许跨域请求  

    });
    const jsonStr = await req.text();
    const res = JSON.parse(jsonStr);
    if (res.status == "ok") {
        return res.data as { [k: string]: any };
    } else {
        console.error(res.data.status);
        return undefined
    }

}